// ---------------------------------------------------------------------------------------------------------------------
//   Copyright (c) SRT Solutions 2009. All rights reserved.
// ---------------------------------------------------------------------------------------------------------------------

using System;
using System.Collections.Generic;
using System.Linq;
using NUnit.Framework;

namespace SRTSolutions.Elevate.Guide
{
    [TestFixture]
    public class EventArgs
    {
        [Test]
        public void ItsJustAnEventArgsWithASingleProperty()
        {
            EventArgs<string> ea = new EventArgs<string>("hi");
            Assert.AreEqual("hi", ea.EventData);
        }
        
        [Test]
        public void ItsNiceWithTupleToo()
        {
            var ea = new EventArgs<Tuple<int, int>> { EventData = Tuple.Create(1, 2) };
            Assert.AreEqual(Tuple.Create(1,2), ea.EventData);
        }

        [Test]
        public void ButThatTupleThingCouldBeBetter()
        {
            var ea = EventArgs<int>.Create(Tuple.Create(1, 2));
            Assert.AreEqual(Tuple.Create(1,2), ea.EventData);
        }

        [Test]
        public void AnyObjectCouldBeAnEventArg()
        {
            int x = 1;
            var ea = x.WrappedInEventArgs();
            Assert.AreEqual(1, ea.EventData);
        }
    }
}
